package org.csmzxy.class2333;

//定义一个Shape类，表示图形
class Shape {
    private String type;     //形状
    private String color;    //颜色
    public Shape(String type, String color){
        this.type  = type;
        this.color = color;
    }
    //重写equals()方法
    @Override
    public  boolean equals(Object obj){
        if(this == obj){
            return true;
        }
        if(obj == null || !(obj instanceof Shape)){
            return false;
        }
        Shape shape = (Shape) obj;
        return type.equals(shape.type) && color.equals(shape.color);
    }
    //重写toString()方法
    @Override
    public String toString() {
        return "Shape{" +
                "type='" + type + '\'' +
                ", color='" + color + '\'' +
                '}';
    }
}
